'use strict';
var Schema = require('mongoose').Schema,
    Model = require('../../../Base/server/controllers/Model');

var modelField = {};

modelField.Code = {
    type: String,
    Name: '编码',
    IsUnique: true,
    IsEmpty: false,
    trim: true
};

modelField.Name = {
    type: String,
    Name: '名称',
    IsEmpty: false,
    trim: true
};

modelField.Menus = {
    type: [
        {
            type: Schema.ObjectId,
            ref: 'Menu'
        }
    ]
};

modelField.IsEffective = {
    type: Boolean
};

modelField.Remark = {
    type: String,
    default: '',
    trim: true
};

var newModel = new Model(modelField);
newModel.addIndex({Name: 1});
newModel.addIndex({Code: 1}, {"unique": true});
newModel.create('Role', '角色');
